package com.lfs.Utils;

import java.util.List;

public class PageModel<T> {
         private int pageCount;
         private int totleNum;
         private int currentPage;
         private int totlePage;
         private List<T> productlist;
         
		public int getPageCount() {
			return pageCount;
		}
		public void setPageCount(int pageCount) {
			this.pageCount = pageCount;
		}
		
		public int getTotleNum() {
			return totleNum;
		}
		public void setTotleNum(int totleNum) {
			this.totleNum = totleNum;
		}
		
		public int getCurrentPage() {
			return currentPage;
		}
		public void setCurrentPage(int currentPage) {
			this.currentPage = currentPage;
		}
		
		public int getTotlePage() {
			if(totleNum % pageCount !=0) totlePage = totleNum/pageCount + 1;
			else totlePage = totleNum/pageCount;
			return totlePage;
		}
		public List<T> getProductlist() {
			return productlist;
		}
		public void setProductlist(List<T> productlist) {
			this.productlist = productlist;
		}
		
		public PageModel(int pageCount, int totleNum, int currentPage, List<T> productlist) {
			super();
			this.pageCount = pageCount;
			this.totleNum = totleNum;
			this.currentPage = currentPage;
			this.productlist = productlist;
		}

        public int prePage() {
			if (currentPage > 1) {
				return currentPage-1;
			}
			return 1;
		}  

        public int nextPage() {
			if (currentPage < totlePage) {
				return currentPage+1;
			}
			return totlePage;
		} 
	    
}
